package net.comm.group.db;


import java.sql.ResultSet;
import java.sql.SQLException;


import net.comm.group.bean.BaseGForum;
import net.comm.util.StringUtil;

import org.sakaiproject.db.api.SqlReader;

public class DbGForumService implements SqlReader
{

	/**
	 * Read from the result one set of fields to create a Resource.
	 * 
	 * @param result
	 *        The Sql query result.
	 * @return The Resource object.
	 */
	public Object readSqlResultRecord(ResultSet result)
	{
		try
		{
			
			int  gForumID = result.getInt(1);	//
			int  groupID = result.getInt(2);		//群组ID
			int  villageID = result.getInt(3);		//群组ID
			String  title = StringUtil.getValue(result.getString(4));		//标题
			String  author = StringUtil.getValue(result.getString(5));		//作者
			String  frsource = StringUtil.getValue(result.getString(6));	//来源
			String  content = StringUtil.getValue(result.getString(7));		//发贴/跟贴内容
			String  intro = StringUtil.getValue(result.getString(8));		//内容简介
			int  fileID = result.getInt(9);									//附件一ID
			int  firsort = result.getInt(10);								//分类一
			int  secsort = result.getInt(11);								//
			int  thisort = result.getInt(12);								//
			String  status = StringUtil.getValue(result.getString(13));		//帖子状态
			String  type = StringUtil.getValue(result.getString(14));		//帖子类型
			String  up = StringUtil.getValue(result.getString(15));			//帖子类型
			String  good = StringUtil.getValue(result.getString(16));		//帖子类型
			int  upCnt = result.getInt(17);								//回复次数
			int  downCnt = result.getInt(18);								//回复次数
			String  tags = StringUtil.getValue(result.getString(19));		//关键词
			int  attachcnt = result.getInt(20);								//点击次数
			int  replycnt = result.getInt(21);								//回复次数
			String  ctime = StringUtil.getValue(result.getString(22));		//
			int  userID = result.getInt(23);		//
			String  IP = StringUtil.getValue(result.getString(24));		//
			int  repuserID = result.getInt(25);	//
			String  mTime = StringUtil.getValue(result.getString(26));		//	

			// create the Resource from these fields
			return new BaseGForum(  gForumID,  groupID, villageID,  title, author,  frsource,  content,  intro,
					 fileID,  firsort,  secsort,  thisort,  status, type,  up,  good, upCnt, downCnt,  tags,  attachcnt,
					 replycnt,  ctime,  userID,  IP, repuserID,  mTime );
				
		}
		catch (SQLException e)
		{
			return null;
		}
		
	}
}
